Skip to content

Conversation

Vignesh050801
Copy link
Collaborator

@Vignesh050801 Vignesh050801 commented Sep 25, 2025

Added Grid with AI Assist view sample.

let suggestionListRef = createRef<any>();
function AssistiveGrid() {

/// <summary>Toolbar options for Grid with AI Assist button</summary>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the commented line

/// <summary>Toolbar options for Grid with AI Assist button</summary>
const toolbarOptions: object[] = [{ tooltipText: 'AI Assist', prefixIcon: 'e-assistview-icon', id: 'ai-assist-btn', align: 'Left' }];

/// <summary>Handles the Grid toolbar button click action. If the AI Assist button clicked shows the AI Assist dialog.</summary>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the commented line

}
}

/// <summary>Configures toolbar settings for AI assist dialog</summary>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

tag alone

template={(data: any) => (
<div className='product-items'>
<img className="rounded" src={`src/ai-components/grid/assistive-grid/sales-transactions-table/${data.product.image}`} width={40} height={40} alt="product image" />
{/* src={data.product.image ? `/sales-transactions-table/${data.product.image}` : '/sales-transactions-table/fallback-image.jpg'} */}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the commented code

import { GridComponent, ColumnsDirective, ColumnDirective, Inject, Toolbar, Sort, Filter, Group, Page, Search, ToolbarItems, FilterSettingsModel } from '@syncfusion/ej2-react-grids';
import { DialogComponent } from '@syncfusion/ej2-react-popups';
import { AIAssistViewComponent, ToolbarSettingsModel, PromptRequestEventArgs } from '@syncfusion/ej2-react-interactive-chat';
import { gadgetsPurchaseData } from './datasource';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maodify this as purchaseDetails

import { AIAssistViewComponent, ToolbarSettingsModel, PromptRequestEventArgs } from '@syncfusion/ej2-react-interactive-chat';
import { gadgetsPurchaseData } from './datasource';
import { createRef } from "react";
import { onPromptExecute } from './AIModel';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

provide a proper name for AI model (fetchAI)

import { onPromptExecute } from './AIModel';
import './assistive-grid.css';

let assistInstance!: AIAssistViewComponent;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variable name should be assistView

import './assistive-grid.css';

let assistInstance!: AIAssistViewComponent;
let dialogInstance!: DialogComponent;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variable name should be dialog


let assistInstance!: AIAssistViewComponent;
let dialogInstance!: DialogComponent;
let gridInstance!:GridComponent;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variable name should be grid

const toolbarClick = (args: any) => {
if (args.item.id === 'ai-assist-btn') {
const gridRect = gridInstance.element.getBoundingClientRect();
const toolbarEleRect = document.getElementById('ai-grid_toolbarItems')!.getBoundingClientRect();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variable name should be toolbarRect

};

// Renders response template for AI prompts.
const responseTemplate = (props: any) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any -> { prompt: string}

import {executeGridAction} from './GridAction';


function fetchAI(text: string | undefined, grid: any, dialog: any, assistView: any, columns: any) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use value type as any. Provide proper type for all the variables.

interface Filter {
field: string;
operator: string;
value: any;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use any here. use string | number | boolean | date

let dialog!: DialogComponent;
let grid!:GridComponent;
let suggestionListRef = createRef<any>();
function AssistiveGrid() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

provide space above the function declaration.

const toolbarOptions: object[] = [{ tooltipText: 'AI Assist', prefixIcon: 'e-assistview-icon', id: 'ai-assist-btn', align: 'Left' }];

// Handles the Grid toolbar button click action. If the AI Assist button clicked shows the AI Assist dialog.
const toolbarClick = (args: any) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use any type here


// Handles prompt request execution.
const onPromptRequest = (args: PromptRequestEventArgs) => {
(assistView as any).stopResponding.classList.remove('e-btn-active');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use any here

<ColumnDirective field="date" headerText="Purchase Date" width="180" format={{ type: "date", format: "MM/dd/yyyy" }} textAlign="Right" />
<ColumnDirective field="paymentMethod" headerText="Payment Method" width="200" />
<ColumnDirective field="status" headerText="Status" width="120" textAlign='Right'
template={(data: any) => (

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use any here

Copy link

@rajapandiyan-settu rajapandiyan-settu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

provide a proper PR template for this implementation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants